package com.zy.cat.entity.mall.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import com.zy.cat.entity.mall.CatGoodsCategoryInfo;
public interface CatGoodsCategoryRepository extends JpaSpecificationExecutor<CatGoodsCategoryInfo>,  JpaRepository<CatGoodsCategoryInfo, String>{
	
	/**
	 * 新版本包含拼多多等类目信息
	 * @info 
	 * @author Link
	 * @date 2020-06-19 14:14
	 * @param level
	 * @return
	 */
	@Query("from CatGoodsCategoryInfo where level=:level AND status=1 AND (ctype=0 OR ctype=1) order by sort")
	List<CatGoodsCategoryInfo> findByLevel(int level);
	
	/**
	 * 不包含拼多多的类目信息
	 * @info 
	 * @author Link
	 * @date 2020-06-19 14:14
	 * @param level
	 * @return
	 */
	@Query("from CatGoodsCategoryInfo where level=:level AND status=1 AND ltype=0 AND (ctype=0 OR ctype=1) order by sort")
	List<CatGoodsCategoryInfo> findByLevelWithOutPDD(int level);
}
